package org.budo.dubbo.protocol.http.cipher;

import org.budo.support.assertion.Assert;
import org.budo.support.java.security.util.AesUtil;

/**
 * @author lmw
 */
public class AESCipherService extends AbstractCipherService {
    protected String cipher(String requestBody, String appSecret) {
        Assert.notEmpty(requestBody, "requestBody is null");
        Assert.notEmpty(appSecret, "appSecret is null");

        return AesUtil.encrypt(requestBody, appSecret);
    }

    @Override
    protected String decipher(String requestBody, String appSecret) {
        Assert.notEmpty(requestBody, "requestBody is null");
        Assert.notEmpty(appSecret, "appSecret is null");

        return AesUtil.decrypt(requestBody, appSecret);
    }
}